<script setup lang="ts">
import useAppStore from '../../../store/modules/app';
import Tools from '@/utils/tools';
import { ESex } from '@/enum';
import { navigate } from '@/utils/navigate';

const store = useAppStore();
const { userInfo, token } = store.$state;
</script>

<template>
  <view class="c-pd">
    <view class="mt-[10%] flex flex-col justify-center items-center">
      <van-image width="100px" height="100px" fit="cover" :src="store.$state.userInfo.imageUrl" class="c-br overflow-hidden position-r" />
      <view class="text-[22px] mt-[12px]">{{ userInfo.nickName }}</view>
      <view class="my-[8px]">{{ ESex[Number(userInfo.sex)] }} </view>
      <view class="c-text-color-grey">{{ Tools.ProtectingPhoneNumbers(userInfo.phone) }}</view>
    </view>

    <view class="mt-[12px]">
      <van-cell-group inset class="mt-[12px]">
        <van-cell title="基本信息" is-link @click="navigate({ url: `/subcontract/person/webView/index?url=${encodeURIComponent(`https://kics.kanglailab.com/essentialInformation?userId=${userInfo.userId}&accessToken=${token}`)}` })">
          <view slot="icon" class="mr-2"> <i class="i-icon-park-twotone:id-card-h text-[18px]"></i></view>
        </van-cell>
        <van-cell title="健康信息" is-link @click="navigate({ url: `/subcontract/person/webView/index?url=${encodeURIComponent(`https://kics.kanglailab.com/healthInformation?userId=${userInfo.userId}&accessToken=${token}`)}` })">
          <view slot="icon" class="mr-2"> <i class="i-ri:health-book-line text-[18px]"></i></view>
        </van-cell>
        <van-cell title="社会关系" is-link @click="navigate({ url: `/subcontract/person/webView/index?url=${encodeURIComponent(`https://kics.kanglailab.com/socialRelations?userId=${userInfo.userId}&accessToken=${token}`)}` })">
          <view slot="icon" class="mr-2"> <i class="i-hugeicons:chart-relationship text-[18px]"></i></view>
        </van-cell>
        <van-cell title="兴趣爱好" is-link @click="navigate({ url: `/subcontract/person/webView/index?url=${encodeURIComponent(`https://kics.kanglailab.com/hobby?userId=${userInfo.userId}&accessToken=${token}`)}` })">
          <view slot="icon" class="mr-2"> <i class="i-material-symbols-light:interests-outline text-[18px]"></i></view>
        </van-cell>
      </van-cell-group>
    </view>
  </view>
</template>
